import { action, observable } from 'mobx'
import { Api } from '@/helper/http'
import SSRStore from '@/helper/mobx/SSRStore'
export default class extends SSRStore {
    @observable list = []
    @observable manga = {}
    @observable chapters = {}
    @action async getMangeList() {
      const { list } = await Api.get(`/manga/mi/mangaList`) || {}
      this.list = list || []
    }

    @action async getMange(id) {
      if (!id) {
        this.manga = {}
        return
      }
      this.manga = await Api.get(`/manga/mi/mangaInfo`, { id }) || {}
    }

    @action async getMangeChapters(id, number = 1) {
      this.chapters = {}
      if (!id) {
        return
      }
      this.chapters = await Api.get(`/manga/mi/mangaChapter`, { id, number }) || {}
    }
}
